const dbConfig = require('../database/dbconfig')
const multer = require('multer')
const upload = multer({ dest: 'uploads/' })


uploadCsvToTable = (req, res) => {
    if (req.body.username === undefined) {
        var postinfo = req.query;
    } else {
        var postinfo = req.body;
    }
    console.log(postinfo)
    let sql = "insert into  aaa * from alarmrecord ";
    let sqlArr = [];
    res.header('Access-Control-Allow-Origin', "*");
    res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
    res.header('Access-Control-Allow-Headers', 'Content-Type');
    let callBack = (err, sqlResult) => {
            if (err) {
                res.send({
                    'error': 'sql execute failed',
                })
            } else {
                res.send({
                    'list': sqlResult
                })
            }
        }
        // dbConfig.sqlConnect(sql, sqlArr, callBack)
}


uploadFile = (req, res) => {
    // console.log(' upload file')
    console.log(req);
    // var content = inputFiles['inputFile'][0].buffer.toString();
}




module.exports = {

    uploadCsvToTable,
    uploadFile,
}